package databean;
import java.sql.ResultSet;
import java.sql.SQLException;

import databean.mydata;

public class User {
	String username;
	String mail;
	
	public User(){

	}
	public void setUsername(String name) {
		username=name;
	}
	public String getUsername() {
		return username;
	}
	
	public String getMail() {
		return mail;
	}
	
	//return a set of result
	public String getMessage(String sname) throws SQLException{
		
		mydata db = new mydata();
		System.out.println("test\n");
		ResultSet rs = null;
		String smail = "";
		try {
		String sql = "select * from users where name='"+sname+"'";
		rs = db.myquery(sql);
		while(rs.next()){
		smail = rs.getString("mail");}
		rs.close();
		db.closesql();
		} catch(SQLException e) {
			System.out.println(e.getMessage());
		}
		return smail;
	}
}
